package cn.yunhe.servlet;

import cn.yunhe.dao.IFoodDaoMapper;
import cn.yunhe.dao.ITypeDaoMapper;
import cn.yunhe.entity.merchantsentity.Type;
import cn.yunhe.services.ShowTypeService;
import cn.yunhe.util.SqlSessionFactoryUtil;
import org.apache.ibatis.session.SqlSession;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.List;

@WebServlet("/shangjia/ShowTypeServlet")
public class ShowTypeServlet extends HttpServlet {

    /**
     * 周依博
     *遍历类别
     * @param
     * @return
     */

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        ShowTypeService showTypeService = new ShowTypeService();

            request.setAttribute("typeList",showTypeService.getAllType());
            request.getRequestDispatcher("product-add.jsp").forward(request,response);


    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }
}
